<template>
  <div class="user-container">
    <!-- 头部 -->
    <div class="header">
      <h1 class="header-title">联系客服</h1>
    </div>

    <!-- 客服内容区域 -->
    <div class="customer-service-section">
      <h1 class="service-title">客户服务</h1>
      
      <div class="service-options">
        <div class="service-option-item" @click="openOnlineService">
          <div class="service-icon">
            <span class="icon-text">💬</span>
          </div>
          <span class="service-text">在线客服</span>
        </div>
        
        <div class="service-option-item" @click="makePhoneCall">
          <div class="service-icon">
            <span class="icon-text">📞</span>
          </div>
          <span class="service-text">电话客服</span>
        </div>
      </div>
    </div>

    <!-- 底部按钮区域 -->
    <div class="bottom-buttons">
      <div class="bottom-button-item" @click="navigateTo('/pages/index/index')">
        <span class="button-icon">🏠</span>
        <span class="button-text">首页</span>
      </div>
      <div class="bottom-button-item" @click="navigateTo('/pages/order/screenshot_order')">
        <span class="button-icon">📝</span>
        <span class="button-text">订单</span>
      </div>
      <div class="bottom-button-item active" @click="navigateTo('/pages/user/index')">
        <span class="button-icon">👤</span>
        <span class="button-text">客服</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

// 页面导航
const navigateTo = (path) => {
  // 使用Vue Router进行路由跳转
  router.push(path)
}

// 在线客服
const openOnlineService = () => {
  alert('正在连接在线客服，请稍候...')
}

// 电话客服
const makePhoneCall = () => {
  alert('客服电话：400-123-4567\n工作时间：9:00-18:00')
}
</script>

<style scoped>
/* 使用CSS变量保持与全局样式一致性 */
:root {
  --primary-color: #1989fa;
  --text-primary: #333;
  --text-secondary: #666;
  --bg-color: #f5f5f5;
  --white: #ffffff;
  --border-color: #e4e7ed;
}

.user-container {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  position: relative;
  padding-bottom: 80px; /* 为底部按钮留出空间 */
}

/* 头部样式 */
.header {
  padding: 10px 16px;
  background-color: var(--primary-color);
  color: var(--white);
  display: flex;
  justify-content: center;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

/* 客服内容区域 */
.customer-service-section {
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.service-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 40px;
  text-align: center;
}

.service-options {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 300px;
}

.service-option-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--white);
  padding: 30px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s;
  cursor: pointer;
}

.service-option-item:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.service-icon {
  margin-bottom: 16px;
}

.icon-text {
  font-size: 48px;
}

.service-text {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}

/* 底部按钮区域 */
.bottom-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  z-index: 999;
}

.bottom-button-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

.bottom-button-item.active {
  color: var(--primary-color);
}

.button-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.button-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.bottom-button-item.active .button-text {
  color: var(--primary-color);
}

/* 响应式设计 */
@media screen and (max-width: 320px) {
  .service-title {
    margin-bottom: 30px;
  }
  
  .service-options {
    gap: 20px;
  }
  
  .service-option-item {
    padding: 25px 16px;
  }
}

/* 移除页面级别的响应式宽度设置，完全依赖全局.app-container的宽度控制 */
@media screen and (min-width: 768px) {
  .bottom-buttons {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}</style>